const fs = require("fs");
const path = require("path");
const http = require("http");

/* let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type", "text/html;charset=utf-8");
    console.log(req.url)
    let urls = req.url
    if(urls == '/') {
        res.write('home page')
    } else if (urls == '/news') {
        res.write('news page')
    } else {
        res.write('404')
    }

    res.end()
}) */

/* let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type", "text/html;charset=utf-8");
    let urls = req.url
    if(urls == '/') {
        res.write('home page')
    } else if (urls == '/news') {
        res.write('news page')
    } else {
        res.write('404')
    }
}) */

let app = http.createServer((req,res)=> {
    res.setHeader("Content-Type", "text/html;charset=utf-8");
    let urls = req.url
    if(urls == '/') {
        res.write('home page')
    } else if (urls == '/news') {
        res.write('news page')
    } else {
        res.write('404')
    }
})


app.listen(3000, () => {
    console.log("3000 run");
  });